class identity_deque(object):
    """
    This is a fake deque. It is initialized with a single element.
    Appending an element does nothing. Popping an element returns
    the identity element of the list but otherwise doesn't modify
    the list
    """
    def __init__(self, element):
        self.element = element
        self.size    = 0

    def append(self, o):
        self.size += 1

    def popleft(self):
        if self.size > 0:
            self.size -= 1
            return self.element
        else:
            raise IndexError("Nothing to dequeue")

    def __iter__(self):
        for i in xrange(0, self.size):
            yield self.element

    def clear(self):
        self.size = 0

